<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="title" value="收支明细表" />
<c:if test="${rcType=='P'}"><c:set var="title" value="支出明细表" /></c:if>
<c:if test="${rcType=='R'}"><c:set var="title" value="收入明细表" /></c:if>
<c:set var="pageTitle" value="${title}" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<script src="/js/QueryList.js"></script>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doShow(billType,billId){
		var url="";
		var h=0;
		var strFeatures="";
		if(billType=="BUSINESS_BILL"){
			url="/business/BusinessBillEdit.ihtm?id="+billId;
			h=600;
		}else if(billType=="RECEIVE_BILL"){
			url="/finance/ReceiveBillEdit.ihtm?id="+billId;
			h=500;
		}else if(billType=="PURCHASE_BILL"){
			url="/purchase/PurchaseBillEdit.ihtm?id="+billId;
			h=500;
		}else if(billType=="PAY_BILL"){
			url="/finance/PayBillEdit.ihtm?id="+billId;
			h=500;
		}else if(billType=="FEE_BILL"){
			url="/finance/FeeBillEdit.ihtm?id="+billId;
			h=420;
		}else if(billType=="INCOME_BILL"){
			url="/finance/IncomeBillEdit.ihtm?id="+billId;
			h=420;
		}else if(billType=="TRANSFER_BILL"){
			url="/finance/TransferBillEdit.ihtm?id="+billId;
			h=420;
		}else if(billType=="COOPER_BILL"){
			url="/cooper/CooperBillEdit.ihtm?id="+billId;
			h=500;
		}else if(billType=="LOAN_BILL"){
			url="/finance/LoanBillEdit.ihtm?id="+billId;
			h=420;
		}else{
			return
		}
		ShowIframe("查看",url,1024,h,"",900,600);
	}
	function doCancel(){
		window.close();
	}
	function doInit(){
		Window_Onload();
	}
	function getSearchCondition(){
		var startDate="${startDate}";
		var endDate="${endDate}";
		var financeType="${financeType}";
		var rcType="${rcType}";
		var baId="${baId}";
		var listType="${listType}";
		var str="ba_id="+baId+"&finance_type="+financeType+"&rc_type="+rcType+"&start_date="+startDate+"&end_date="+endDate+"&list_type="+listType;
		return str;
	}
	function doPrint(){
		var str=getSearchCondition();
		showWin(900,600,"/finance/AccountDetailList.ihtm?content_type=PRINT&"+str);
	}
	function doDownload(){
		var str=getSearchCondition();
		window.location="/finance/AccountDetailList.ihtm?content_type=EXCEL&"+str;
	}
	function doList(){
		var listType="${listType}";
		if(listType=="LOG"){
			listType="BILL";
		}else{
			listType="LOG";
		}
		var startDate="${startDate}";
		var endDate="${endDate}";
		var financeType="${financeType}";
		var rcType="${rcType}";
		var baId="${baId}";
		var str="ba_id="+baId+"&finance_type="+financeType+"&rc_type="+rcType+"&start_date="+startDate+"&end_date="+endDate+"&list_type="+listType;
		window.location="/finance/AccountDetailList.ihtm?"+str;
	}
</script>
</head>
<body onLoad="doInit();" class="sheet" style="text-align:center;">
<div class="sheet-main" style="width:860px;text-align:left;margin:auto;">
  <div class="sheet-top">
    <div class="content">
      <h2>${baName} ${title}</h2>
      <p>${startDate} 至 ${endDate}</p>
    </div>
  </div>
	  <div class="sheet-list">
	    <div class="search-business">
	      <div class="content">
              <div align="right">
              	<a href="javascript:doList();"><c:if test="${listType=='LOG'}">按单据日期查询</c:if><c:if test="${listType!='LOG'}">按日志查询</c:if></a>
				<input type="button" class="buttom search-print" value=" 打 印 " onClick="doPrint();">
				<input type="button" class="buttom search-out" value=" 导 出 " onClick="doDownload();">      
			   </div>
	      </div>
	      <div class="cue-info">
	      	<c:if test="${rcType=='R'}"><span>收入小计：${rcostTotal} 元</span></c:if>
			<c:if test="${rcType=='P'}"><span>支出小计：${pcostTotal} 元</span></c:if>
			<c:if test="${rcType!='P' && rcType!='R'}"><span>收入小计：${rcostTotal} 元&nbsp;&nbsp;支出小计：${pcostTotal} 元</span></c:if>
	      </div>
	      <div class="table-list">
	        <table width="100%">
				<tr>
					<c:if test="${listType!='LOG'}">
					<th width="10%">日期</th>
					<th width="14%">单号</th>
					<th width="8%">类型</th>
					<th width="18%">摘要</th>
					<th width="10%">经办人</th>
					<th width="12%">收入</th>
					<th width="12%">支出</th>
					<th width="14%">账户</th>
					</c:if>
					<c:if test="${listType=='LOG'}">
					<th width="10%">记账日期</th>
					<th width="14%">单号</th>
					<th width="8%">类型</th>
					<th width="16%">摘要</th>
					<th width="8%">经办人</th>
					<th width="10%">收入</th>
					<th width="10%">支出</th>
					<th width="12%">账户余额</th>
					<th width="12%">账户</th>
					</c:if>
				</tr>
				<c:forEach var="item" items="${list}" varStatus="i">
					<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
					<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
					<c:set var="defaultFontColor" value="#000000" />
					<c:if test="${item.operType=='UN_EXAM' || item.operType=='CANC'}"><c:set var="defaultFontColor" value="red" /></c:if>
					<tr class="${trClass}" index="${i.index+1}" style="color:${defaultFontColor}" defaultFontColor="${defaultFontColor}" onmouseout='javascript:mouseout(this)' onmouseover='javascript:mouseover(this)'>
						<td>
							<c:if test="${listType=='LOG'}"><fmt:formatDate value="${item.costDate}" pattern="yyyy-MM-dd HH:mm" /></c:if>
							<c:if test="${listType!='LOG'}"><fmt:formatDate value="${item.billDate}" pattern="yyyy-MM-dd" /></c:if>
						</td>
						<td><a href="javascript:doShow('${item.billType}','${item.billId}');">${item.billCode}</a></td>
						<td>${item.costType}</td>
						<td>${item.mark}</td>
						<td>${item.managerName}</td>
						<td>
							<c:if test="${item.rcType=='R'}">${item.cost}</c:if>
							<c:if test="${item.rcType=='P'}">0</c:if>
						</td>
						<td>
							<c:if test="${item.rcType=='R'}">0</c:if>
							<c:if test="${item.rcType=='P'}">${item.cost}</c:if>
						</td>
						<c:if test="${listType=='LOG'}">
						<td>${item.baCost}</td>
						</c:if>
						<td><commonTag:showSimpleObjectName list="${baList}" objectId="${item.bankAccountId}" /></td>
					</tr>
				</c:forEach>
			</table>
	      </div>     
	    </div>
	  </div>
	<div class="blank12"></div>
</div>
</body>
</html>